package com.cupk.carManageMaster.api.controller;
/**
 * @Software: IntelliJ IDEA
 * @Project: car-manage-master
 * @File: AdministrationController.java
 * @Author: 箬玉
 * @Description: 行政模块Controller层
 * @Date: 2023/6/9 21:56
 */

import com.cupk.carManageMaster.common.domain.ResponseBase;
import com.cupk.carManageMaster.core.serviceImpl.AdministrationServiceImpl;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName: AdministrationController
 * @Author: 箬玉
 * @Description: 行政模块Controller层
 * @Date: 2023/6/9 21:56
 */
@Controller
@CrossOrigin(origins = "*")
@RequestMapping("/administration")
public class AdministrationController {
    private final AdministrationServiceImpl administrationService;

    public AdministrationController(AdministrationServiceImpl administrationService) {
        this.administrationService = administrationService;
    }

    @PostMapping("/upload/car")
    @ResponseBody
    public ResponseBase uploadCar(@RequestBody String excelData) {
        return administrationService.uploadCar(excelData);
    }

    @PostMapping("/change/car")
    @ResponseBody
    public ResponseBase changeCar(@RequestBody String objectData) {
        return administrationService.changeCar(objectData);
    }

    @GetMapping("/get/car/list")
    @ResponseBody
    public ResponseBase getCarList() {
        return administrationService.getCarList();
    }

    @GetMapping("/get/car/dispatch")
    @ResponseBody
    public ResponseBase getCarDispatch(@RequestParam("car_id") Long carId) {
        return administrationService.getCarDispatch(carId);
    }

    @GetMapping("/delete/car")
    @ResponseBody
    public ResponseBase deleteCar(@RequestParam("id") Long id) {
        return administrationService.deleteCar(id);
    }

    @GetMapping("/get/car/now")
    @ResponseBody
    public ResponseBase getCarNow() {
        return administrationService.getCarNow();
    }

    @GetMapping("/car/type/list")
    @ResponseBody
    public ResponseBase carTypeList() {
        return administrationService.carTypeList();
    }

    @GetMapping("/get/car/free")
    @ResponseBody
    public ResponseBase getCarFree(@RequestParam("type_car_id") Long typeCarId) {
        return administrationService.getCarFree(typeCarId);
    }

    @GetMapping("/get/driver/free")
    @ResponseBody
    public ResponseBase getDriverFree(@RequestParam("type_car_id") Long typeCarId) {
        return administrationService.getDriverFree(typeCarId);
    }

    @PostMapping("/car/task")
    @ResponseBody
    public ResponseBase carTask(@RequestBody String objectData) {
        return administrationService.carTask(objectData);
    }

    @GetMapping("/get/resort")
    @ResponseBody
    public ResponseBase getResort() {
        return administrationService.getResort();
    }


}
